/*     */ package com.umeng.newxp.net;
/*     */ 
/*     */ import android.content.Context;
/*     */ import android.location.Location;
/*     */ import android.os.Build;
/*     */ import android.os.Build.VERSION;
/*     */ import android.text.TextUtils;
/*     */ import com.umeng.common.Log;
/*     */ import com.umeng.common.b;
/*     */ import com.umeng.common.net.o;
/*     */ import com.umeng.common.util.h;
/*     */ import com.umeng.common.util.i;
/*     */ import com.umeng.newxp.Promoter;
/*     */ import com.umeng.newxp.common.ExchangeConstants;
/*     */ import com.umeng.newxp.common.g;
/*     */ import java.util.ArrayList;
/*     */ import java.util.HashMap;
/*     */ import java.util.Iterator;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import java.util.Random;
/*     */ import java.util.Set;
/*     */ import org.json.JSONException;
/*     */ import org.json.JSONObject;
/*     */ 
/*     */ public class e extends o
/*     */ {
/*     */   public Map<String, Object> a;
/*     */   public static String[] e;
/*     */ 
/*     */   public e(Map<String, Object> paramMap)
/*     */   {
/*  43 */     this.a = paramMap;
/*     */   }
/*     */ 
/*     */   public String c()
/*     */   {
/*  48 */     return c;
/*     */   }
/*     */ 
/*     */   public JSONObject a()
/*     */   {
/*  57 */     return new JSONObject(this.a);
/*     */   }
/*     */ 
/*     */   public static e a(JSONObject paramJSONObject) throws JSONException
/*     */   {
/*  62 */     Iterator localIterator = paramJSONObject.keys();
/*  63 */     HashMap localHashMap = new HashMap();
/*  64 */     while (localIterator.hasNext()) {
/*  65 */       String str = (String)localIterator.next();
/*  66 */       localHashMap.put(str, paramJSONObject.get(str));
/*     */     }
/*  68 */     return new e(localHashMap);
/*     */   }
/*     */ 
/*     */   public String b()
/*     */   {
/*  73 */     String str = i.a(this.a, this.d);
/*  74 */     return str.toString();
/*     */   }
/*     */ 
/*     */   public String e() {
/*  78 */     HashMap localHashMap = new HashMap();
/*  79 */     Set localSet = this.a.keySet();
/*  80 */     for (String str : localSet) {
/*  81 */       if ((!str.equals("date")) && 
/*  82 */         (!str.equals("action_type")) && 
/*  83 */         (!str.equals("time")) && 
/*  84 */         (!str.equals("ts")))
/*     */       {
/*  87 */         localHashMap.put(str, this.a.get(str));
/*     */       }
/*     */     }
/*  90 */     return i.a(localHashMap, this.d);
/*     */   }
/*     */   public static class a { private String c;
/*     */     private String d;
/*     */     private String e;
/*     */     private String f;
/*     */     private String g;
/*     */     private String h;
/*     */     private String i;
/*     */     private String j;
/*     */     private int k;
/*     */     private long l;
/*     */     private String m;
/*     */     private String n;
/*     */     private String o;
/*     */     private String p;
/*     */     private String q;
/*     */     private int r;
/*     */     private int s;
/*     */     private int t;
/*     */     private int u;
/*     */     private String v;
/* 132 */     private static final Random w = new Random();
/*     */     private static final int x = 32767;
/*     */     private int y;
/*     */     private String z;
/* 137 */     private int A = 0;
/*     */ 
/* 142 */     private int B = 1;
/*     */     Context a;
/*     */     List<Promoter> b;
/*     */ 
/* 149 */     public a a(String paramString) { this.d = paramString;
/* 150 */       return this; }
/*     */ 
/*     */     public a b(String paramString)
/*     */     {
/* 154 */       this.c = paramString;
/* 155 */       return this;
/*     */     }
/*     */ 
/*     */     public a c(String paramString) {
/* 159 */       this.g = paramString;
/* 160 */       return this;
/*     */     }
/*     */ 
/*     */     public a a(int paramInt) {
/* 164 */       this.r = paramInt;
/* 165 */       return this;
/*     */     }
/*     */ 
/*     */     public a b(int paramInt) {
/* 169 */       this.s = paramInt;
/* 170 */       return this;
/*     */     }
/*     */ 
/*     */     public a c(int paramInt) {
/* 174 */       this.t = paramInt;
/* 175 */       return this;
/*     */     }
/*     */ 
/*     */     public a d(int paramInt) {
/* 179 */       this.u = paramInt;
/* 180 */       return this;
/*     */     }
/*     */ 
/*     */     public a e(int paramInt) {
/* 184 */       this.B = paramInt;
/* 185 */       return this;
/*     */     }
/*     */ 
/*     */     public a f(int paramInt) {
/* 189 */       this.A = paramInt;
/* 190 */       return this;
/*     */     }
/*     */ 
/*     */     public a d(String paramString) {
/* 194 */       this.z = paramString;
/* 195 */       return this;
/*     */     }
/*     */ 
/*     */     public a a(Promoter[] paramArrayOfPromoter) {
/* 199 */       for (Promoter localPromoter1 : paramArrayOfPromoter) {
/* 200 */         this.b.add(localPromoter1);
/*     */       }
/* 202 */       if ((this.b != null) && (this.b.size() > 0)) {
/* 203 */         int i1 = this.b.size();
/* 204 */         StringBuffer localStringBuffer1 = new StringBuffer();
/* 205 */         StringBuffer localStringBuffer2 = new StringBuffer();
/*     */ 
/* 207 */         for (int i4 = 0; i4 < i1; i4++) {
/* 208 */           Promoter localPromoter2 = (Promoter)this.b.get(i4);
/* 209 */           localStringBuffer1.append(localPromoter2.promoter + ",");
/* 210 */           localStringBuffer2.append(localPromoter2.category + ",");
/*     */         }
/* 212 */         localStringBuffer1.deleteCharAt(localStringBuffer1.length() - 1);
/* 213 */         this.n = localStringBuffer1.toString();
/* 214 */         this.o = localStringBuffer2.toString();
/*     */       }
/* 216 */       return this;
/*     */     }
/*     */ 
/*     */     public a(Context paramContext) {
/* 220 */       this.a = paramContext;
/* 221 */       this.b = new ArrayList();
/*     */     }
/*     */ 
/*     */     public e a() {
/* 225 */       Map localMap = b();
/* 226 */       return new e(localMap);
/*     */     }
/*     */ 
/*     */     public Map<String, Object> b() {
/* 230 */       this.e = ExchangeConstants.sdk_version;
/* 231 */       this.f = ExchangeConstants.protocol_version;
/*     */ 
/* 233 */       this.h = b.g(this.a);
/*     */ 
/* 235 */       String str = h.a();
/* 236 */       this.i = str.split(" ")[0];
/* 237 */       this.j = str.split(" ")[1];
/* 238 */       this.l = System.currentTimeMillis();
/*     */ 
/* 240 */       this.k = b.o(this.a);
/*     */ 
/* 242 */       this.m = (b.c(this.a) ? "0" : "1");
/*     */ 
/* 244 */       this.v = g.y(this.a);
/*     */ 
/* 246 */       this.y = w.nextInt(32767);
/*     */       try
/*     */       {
/* 249 */         String[] arrayOfString = b.k(this.a);
/* 250 */         this.p = arrayOfString[0];
/*     */ 
/* 253 */         if ("2G/3G".equals(arrayOfString[0]))
/* 254 */           this.q = arrayOfString[1];
/*     */       }
/*     */       catch (Exception localException) {
/* 257 */         this.p = "Unknown";
/*     */       }
/*     */ 
/* 261 */       Map localMap = c();
/* 262 */       if (ExchangeConstants.DEBUG_MODE) {
/* 263 */         boolean bool = a(localMap);
/* 264 */         if (!bool)
/* 265 */           Log.e(ExchangeConstants.LOG_TAG, "Report params verify failed...");
/*     */       }
/* 267 */       return localMap;
/*     */     }
/*     */ 
/*     */     private boolean a(Map<String, Object> paramMap) {
/* 271 */       if (e.e == null) {
/* 272 */         e.e = new String[] { 
/* 275 */           "category", 
/* 276 */           "sid", 
/* 277 */           "device_id", 
/* 278 */           "idmd5", "mc", 
/* 279 */           "action_type", 
/* 280 */           "action_index", 
/* 281 */           "layout_type", 
/* 282 */           "time", 
/* 283 */           "date", 
/* 284 */           "access", 
/* 285 */           "access_subtype" };
/*     */       }
/*     */ 
/* 291 */       if ((paramMap == null) || (paramMap.size() == 0)) return false;
/*     */ 
/* 293 */       boolean bool = true;
/* 294 */       for (String str : e.e) {
/* 295 */         if (!paramMap.containsKey(str)) {
/* 296 */           bool = false;
/* 297 */           Log.e(ExchangeConstants.LOG_TAG, "Report params has no required param [" + 
/* 298 */             str + "]");
/*     */         }
/*     */ 
/*     */       }
/*     */ 
/* 303 */       return bool;
/*     */     }
/*     */ 
/*     */     private Map<String, Object> c() {
/* 307 */       HashMap localHashMap = new HashMap();
/*     */       try
/*     */       {
/* 310 */         if (!h.d(this.d)) {
/* 311 */           localHashMap.put("slot_id", this.d);
/*     */         }
/* 313 */         else if (!h.d(this.c)) {
/* 314 */           localHashMap.put("app_key", this.c);
/*     */         } else {
/* 316 */           Log.b(ExchangeConstants.LOG_TAG, 
/* 317 */             "Both UMENG_APPKEY and UMENG_SLOTID are empty, please specify either one.  Report aborted.");
/* 318 */           return null;
/*     */         }
/*     */ 
/* 322 */         localHashMap.put("sdk_version", this.e);
/* 323 */         localHashMap.put("protocol_version", this.f);
/* 324 */         localHashMap.put("ts", Long.valueOf(this.l));
/* 325 */         localHashMap.put("device_model", Build.MODEL);
/*     */ 
/* 327 */         String str = b.r(this.a);
/* 328 */         if (!TextUtils.isEmpty(str)) {
/* 329 */           localHashMap.put("mc", str);
/*     */         }
/* 331 */         localHashMap.put("carrier", 
/* 332 */           b.i(this.a));
/*     */ 
/* 334 */         localHashMap.put("os_version", Build.VERSION.RELEASE);
/*     */ 
/* 336 */         localHashMap.put("os", "android");
/*     */ 
/* 338 */         localHashMap.put("rid", Integer.valueOf(this.y));
/*     */ 
/* 340 */         localHashMap.put("access", this.p);
/* 341 */         if (!h.d(this.q)) {
/* 342 */           localHashMap.put("access_subtype", this.q);
/*     */         }
/* 344 */         if (!h.d(this.z)) {
/* 345 */           localHashMap.put("tcost", this.z);
/*     */         }
/*     */ 
/* 348 */         if (!h.d(this.g)) {
/* 349 */           localHashMap.put("sid", this.g);
/*     */         }
/*     */ 
/* 352 */         if (!h.d(this.h)) {
/* 353 */           localHashMap.put("device_id", this.h);
/* 354 */           localHashMap.put("idmd5", h.a(this.h));
/*     */         }
/*     */ 
/* 357 */         Location localLocation = b.m(this.a);
/* 358 */         if (localLocation != null) {
/* 359 */           localHashMap.put("lat", 
/* 360 */             String.valueOf(localLocation.getLatitude()));
/* 361 */           localHashMap.put("lng", 
/* 362 */             String.valueOf(localLocation.getLongitude()));
/* 363 */           long l1 = localLocation.getTime();
/* 364 */           localHashMap.put("gpst", 
/* 365 */             String.valueOf(l1));
/*     */         }
/*     */ 
/* 368 */         localHashMap.put("date", this.i);
/* 369 */         localHashMap.put("time", this.j);
/*     */ 
/* 371 */         localHashMap.put("timezone", Integer.valueOf(this.k));
/*     */ 
/* 373 */         localHashMap.put("orientation", this.m);
/*     */ 
/* 375 */         if (h.d(this.n)) {
/* 376 */           Log.b(ExchangeConstants.LOG_TAG, "Empty promoters found. Report aborted.");
/* 377 */           return null;
/*     */         }
/*     */ 
/* 380 */         localHashMap.put("promoter", this.n);
/* 381 */         localHashMap.put("category", this.o);
/*     */ 
/* 383 */         localHashMap.put("action_type", Integer.valueOf(this.r));
/*     */ 
/* 385 */         localHashMap.put("action_index", Integer.valueOf(this.s));
/*     */ 
/* 387 */         localHashMap.put("layout_type", Integer.valueOf(this.t));
/*     */ 
/* 389 */         localHashMap.put("page_level", Integer.valueOf(this.u));
/*     */ 
/* 391 */         if (!h.d(this.v)) {
/* 392 */           localHashMap.put("channel", this.v);
/*     */         }
/*     */ 
/* 395 */         if (this.A != 0) {
/* 396 */           localHashMap.put("display_style", Integer.valueOf(this.A));
/*     */         }
/* 398 */         localHashMap.put("page_content_type", Integer.valueOf(this.B));
/*     */       }
/*     */       catch (Exception localException) {
/* 401 */         localException.printStackTrace();
/*     */       }
/* 403 */       return localHashMap;
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\umeng_sdk.jar
 * Qualified Name:     com.umeng.newxp.net.e
 * JD-Core Version:    0.6.2
 */